//
//  PopSelectionCell.m
//  JinMaJiaDemo
//
//  Created by GripMeMory on 15/9/22.
//  Copyright © 2015年 GripMeMory. All rights reserved.
//

#import "PopSelectionCell.h"
#import "UIView+Sizes.h"

@implementation PopSelectionCell

{
    UIView *view;
    UILabel *label;
    UIImageView *icon;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        view = [[UIView alloc] init];
        view.backgroundColor = [UIColor whiteColor];
        label = [[UILabel alloc] init];
        label.textColor = [UIColor whiteColor];
        label.textAlignment = NSTextAlignmentCenter;
        icon = [[UIImageView alloc] init];
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}

- (void)layoutSubviews{
    icon.frame = CGRectMake(15, 15, self.height - 30, self.height - 30);
    view.frame = CGRectMake(0, self.height, self.width, 1);
    label.frame = CGRectMake(icon.right,  0, self.width - icon.width - 10, self.height - 1);
    label.font = [UIFont systemFontOfSize:13];
    [self.contentView addSubview:label];
    [self.contentView addSubview:view];
    [self.contentView addSubview:icon];
}

- (void)configureCellWithModel:(NSString *)model{
    if ([model isEqualToString:@"消息"]) {
        icon.image = [UIImage imageNamed:@"消息1"];
    }else if([model isEqualToString:@"分享"]){
        icon.image = [UIImage imageNamed:@"分享"];
    }else if([model isEqualToString:@"搜索"]){
        icon.image = [UIImage imageNamed:@"搜索1"];
    }else{
        icon.image = [UIImage imageNamed:@"首页"];
    }
    label.text = model;
}


@end
